package com.example.indenture.race.entity;


import com.example.indenture.common.entity.AbstractEntity;
import com.example.indenture.company.entity.Company;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import org.springframework.stereotype.Component;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Entity
@Table(name = "race")
@Component
public class Race extends AbstractEntity {
    private int cid;
    private int branks;
    private int sranks;
    private BigDecimal money;
    @Column(unique = true)
    private String name;
    private String url;
    private String des;


    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime deadline;
    @Transient
    private Company company;
}
